package org.example.springioc01.config;


import org.example.condition.MacCondition;
import org.example.condition.WindowsCondition;
import org.example.springioc01.bean.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Configuration
public class PersonConfig {

    @Conditional(WindowsCondition.class)
    @Bean("bll")
    public Person person(){
        Person p = new Person();
        p.setAge(30);
        p.setName("比尔盖茨");
        p.setSex(1);
        return p;
    }



    @Conditional(MacCondition.class)
    @Bean("qbex")
    public Person person1(){
        Person p = new Person();
        p.setAge(50);
        p.setName("乔布斯");
        p.setSex(1);
        return p;
    }
}
